package com.zlx.controller;

import com.zlx.entities.Student;
import com.zlx.service.StudentServcue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @Author 周罗校
 * @Description
 * @ClassName TestController
 * @date 2020.10.15 11:24:09
 * 该版权归周罗校所有，最终解释权以官方为准
 */

@Controller
@RequestMapping("/user/")
public class TestController {
    @Autowired
    private StudentServcue studentServcue;

    @RequestMapping(value = "test",method = RequestMethod.GET)
    public String test(){
        Student studentById = studentServcue.getStudentById(13);
        System.out.println(studentById);
//        int i=1/0;
        return "forward:/user/change";
    }

    @RequestMapping(value = "change",method = RequestMethod.GET)
    public String change(Model model){
        Student studentById = studentServcue.getStudentById(13);
        System.out.println(studentById);
        model.addAttribute("msg",studentById);
        return "succes";
    }
}
